#! /bin/sh
#
# Program: parucli.sh
# Version: V1.6
# Author : Zhen-Hua Feng
# Email  : fengzhenhua@outlook.com
# Date   : 2025-03-23 20:12
# Copyright (C) 2023 feng <feng@arch>
#
# Distributed under terms of the MIT license.
#
#
# url="https://github.com/gaozhangmin/aliyunpan/releases/download/v3.13.5/XBYDriver-3.13.5-linux-amd64.deb"
# P_REP=`echo $url | cut -f4-5 -d'/'`
# P_VER=`echo $url | cut -f8 -d'/'`
# P_PKG=`echo $url | cut -f9 -d'/'`
# /usr/bin/gh release download ${P_VER} --pattern "${P_PKG}" -R ${P_REP}
P_REP=`echo $2 | cut -f4-5 -d'/'`
P_VER=`echo $2 | cut -f8 -d'/'`
P_PKG=`echo $2 | cut -f9 -d'/'`
case "$GIT_DOMIN" in
    "github.com")
        /usr/bin/gh release download ${P_VER} --pattern "${P_PKG}" -R ${P_REP}
        mv ${P_PKG} $1
        ;;
    *)
        /usr/bin/axel -n 15 -a -o $1 $2;
        ;;
esac
